<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<html>
<head>
    <title>商品上下架</title>
    <meta name="decorator" content="default"/>
    <script type="text/javascript">
        function page(n, s) {
            $("#pageNo").val(n);
            $("#pageSize").val(s);
            $("#searchForm").attr("action", "${ctx}/sys/tbAgentProductController/showProductPage");
            $("#searchForm").submit();
            return false;
        }
    </script>
</head>
<body>
<ul class="nav nav-tabs">
    <li class="active"><a href="#">商品上下架</a></li>
</ul>
<form:form id="searchForm" modelAttribute="tbProduct" action="${ctx}/sys/tbAgentProductController/showProductPage"
           method="post" class="breadcrumb form-search">
    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
    <ul class="ul-form">
        <li><label>商品名称：</label>
            <form:input path="title" htmlEscape="false" maxlength="11" class="input-medium"/>
        </li>
        <li> &nbsp; &nbsp; 商品类别:
            <select name="reserveFlag" class="input-medium">
                <option value="" >请选择</option>
                <option value="3" <c:if test="${tbProduct.reserveFlag==3}">selected</c:if>>生活预定</option>
                <option value="4" <c:if test="${tbProduct.reserveFlag==4}">selected</c:if>>便利生活</option>
                <option value="2" <c:if test="${tbProduct.reserveFlag==2}">selected</c:if>>海外代购</option>
            </select>
                <%--<form:input path="reserveFlag" htmlEscape="false" maxlength="3" class="input-medium"/>--%>
        </li>
        <li> &nbsp; &nbsp; 商品状态:
            <select name="isStatus" class="input-medium">
                <option value="-1" >请选择</option>
                <option value="1" <c:if test="${tbProduct.isStatus==1}">selected</c:if> >已上架</option>
                <option value="0" <c:if test="${tbProduct.isStatus==0}">selected</c:if> >已下架</option>
            </select>
                <%--<form:input path="reserveFlag" htmlEscape="false" maxlength="3" class="input-medium"/>--%>
        </li>
        <li class="btns">&nbsp;&nbsp;<input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
        <li class="clearfix"></li>
    </ul>
</form:form>
<sys:message content="${message}"/>

<span><font style="color: #00A6C7">${message1}</font></span>
<table id="contentTable" class="table table-striped table-bordered table-condensed">
    <thead>
        <tr>
            <td>ID</td>
            <th>商品名称</th>
            <th>条形码</th>
            <th>属性</th>
            <th>价格</th>
            <th>库存</th>
            <th>单位</th>
        <%--    <th>排序</th>--%>
        <%--    <th>是否维护库存</th>--%>
            <th>是否可用物业钱包</th>
            <th>商品类别</th>
            <th>商品状态</th>
            <th>操作</th>
        </tr>
    </thead>
    <tbody>
    <c:forEach items="${page.list}" var="tbProduct">
        <tr>
            <td>${tbProduct.id}</td>
            <td>${tbProduct.title}</td>
            <td>${tbProduct.barcode}</td>
            <td>
                    ${tbProduct.attr}
            </td>
            <td>${tbProduct.price}</td>
            <td>${tbProduct.num}</td>
            <td>
                    ${tbProduct.size}
            </td>
          <%--  <td>${tbProduct.proSort}</td>
            <td><c:if test="${tbProduct.isMaintainStoreNum==0}">否</c:if><c:if test="${tbProduct.isMaintainStoreNum==1}">是</c:if></td>--%>
            <td><c:if test="${tbProduct.isUseMqWallet==0}">否</c:if><c:if test="${tbProduct.isUseMqWallet==1}">是</c:if></td>
            <td>
                <c:choose>
                    <c:when test="${tbProduct.reserveFlag==3}">
                        生活预定
                    </c:when>
                    <c:when test="${tbProduct.reserveFlag==4}">
                        便利生活
                    </c:when>
                    <c:when test="${tbProduct.reserveFlag==2}">
                        海外代购
                    </c:when>
                </c:choose>
            </td>
            <td><c:if test="${tbProduct.status==0}">已下架</c:if><c:if test="${tbProduct.status==1}">已上架</c:if></td>
            <td>
                <c:if test="${tbProduct.status==0}"><a href="${ctx}/sys/tbAgentProductController/updateStatus?id=${tbProduct.id}&status=1">上架</a></c:if>
                <c:if test="${tbProduct.status==1}"><a href="${ctx}/sys/tbAgentProductController/updateStatus?id=${tbProduct.id}&status=0" onclick="return confirmx('确认要下架该商品吗？', this.href)">下架</a></c:if>
            </td>
        </tr>
    </c:forEach>
    </tbody>
</table>
<div class="pagination">${page}</div>
</body>
</html>
